﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using TMDT_Nhom1A.DAO;
using TMDT_Nhom1A.DTO;
using System.Collections;
namespace TMDT_Nhom1A.BUS
{
    public class Customer_BUS
    {
        public static bool RegistryAccount(Customer_DTO user,ref string uid)
        {
            try
            {
                return Customer_DAO.RegistryAccount(user,ref uid);
            }
            catch (Exception)
            {
                return false;
            }
            
        }

        public static void GetRoleOfUser(string UserName, ref string UserID, ref string Role)
        {
            Customer_DAO.GetRoleOfUser(UserName,ref UserID,ref Role);
        }

        public static bool activateAccount(int userID,ref string username)
        {
            return Customer_DAO.activateAccount(userID,ref username);
        }

        //lay ra tat ca cac tai khoan
        public static List<USER> getAllAccount()
        {
            return Customer_DAO.getAllAccount();
        }

        //lay thong tin trong bang customer
        public static List<Customer_DTO> getCustomerInfoByUserID(int userID)
        {
            return Customer_DAO.getCustomerInfoByUserID(userID);
        }

        //update customer
        public static bool updateUserInfo(Customer_DTO customer)
        {
            return Customer_DAO.updateUserInfo(customer);
        }

        public static List<ORDER_B2B> GetBillPaiedBuyOnline(string UserID)
        {
            return Customer_DAO.GetBillPaiedBuyOnline(UserID);
        }

        public static List<ORDER_COUPON> GetBillPaiedBuyByCompany(string UserID)
        {
            return Customer_DAO.GetBillPaiedBuyByCompany(UserID);
        }

        public static List<ORDER_DETAIL> GetDetailBillPaiedBuyOnline(string OrderB2B_ID, ref string OrderDate)
        {
            return Customer_DAO.GetDetailBillPaiedBuyOnline(OrderB2B_ID, ref OrderDate);
        }

        public static List<ORDER_COUPON_DETAIL> GetDetailBillPaiedBuyByCompany(string OrderCouponID, ref string OrderDate)
        {
            return Customer_DAO.GetDetailBillPaiedBuyByCompany(OrderCouponID, ref OrderDate);
              
        }

        public static void UpdateInformationOfCustomer(Customer_DTO customer, int flag)
        {
            Customer_DAO.UpdateInformationOfCustomer(customer, flag);
        }

        //tim kiem user theo username
        public static List<USER> searchUserByUsername(string username)
        {
            return Customer_DAO.searchUserByUsername(username);
        }
    }
}
